package com.eagle.epay.controller;


import com.eagle.epay.enums.StatusCode;
import com.eagle.epay.response.BaseResponse;
import com.eagle.epay.service.IUserService;
import com.eagle.epay.service.ThreadService;
import com.eagle.epay.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 * 发送邮件controller
 * @Author:debug (SteadyJack)
 * @Link: weixin-> debug0868 qq-> 1948831260
 * @Date: 2019/11/7 17:52
 **/
@RestController
@RequestMapping("thread")
public class ThreadController {

    @Autowired
    private ThreadService threadService;

	@Autowired
	private IUserService userService;

	@RequestMapping(value = "testAsync",method = RequestMethod.GET)
	public BaseResponse testAsync(){
		BaseResponse response=new BaseResponse(StatusCode.Success);
		String s = userService.doSomething();
		System.out.println("do other thing here");
		System.out.println("the excute result is: "+s);
		return response;
	}

    @RequestMapping(value = "all/insert/data",method = RequestMethod.GET)
    public BaseResponse insertAllData(){
        BaseResponse response=new BaseResponse(StatusCode.Success);
        try {
            threadService.insertDatas();

        }catch (Exception e){
            response=new BaseResponse(StatusCode.Fail.getCode(),e.getMessage());
        }
        return response;
    }
}






























